import 'package:flutterapp/config/keys.dart';
import 'package:flutterapp/model/all_model.dart';
import 'package:flutterapp/utils/shared_util.dart';


class GlobalLogic{

  final GlobalModel _model;

  GlobalLogic(this._model);

  ///获取app的名字
  Future getAppName() async{
    final appName = await SharedUtil.instance.getString(Keys.appName);
    if(appName == null) return;
    if(appName == _model.appName) return;
    _model.appName = appName;
  }

  ///用于判断是否进入登录页面
  Future getLoginState() async{
    final hasLogged = await SharedUtil.instance.getBoolean(Keys.hasLogged);
    _model.goToLogin = !hasLogged;
  }
}